package com.turing.post.datatranferpmbs.impl;

import java.util.List;

import javax.ejb.Local;
import javax.ejb.Remote;
import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import javax.persistence.Query;

import com.turing.post.datatranferpmbs.util.MchBindingTies;
import com.turing.post.datatranferpmbs.util.MchBindingTiesDao;

@Stateless(mappedName = "datatranferpmbs.impl.MchBindingTiesDaoImpl")
@Remote
@Local
public class MchBindingTiesDaoImpl implements MchBindingTiesDao {
	/**
	 * 实体管理器
	 */
	@PersistenceContext
	protected EntityManager _em;
	
	@SuppressWarnings("unchecked")
	@Override
	public MchBindingTies getMchBindingTiesByCardNo(String cardNo) {
		String sql="select t.* from mchbindingties t where t.cardno=?1";
		Query query=_em.createNativeQuery(sql, MchBindingTies.class);
		query.setParameter(1, cardNo);
		List<MchBindingTies> mbtList=query.getResultList();
		MchBindingTies mbt=null;
		if(mbtList!=null && mbtList.size()>0){
			mbt=mbtList.get(0);
		}
		return mbt;
	}

}
